<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户角色管理</title>
    <script type="text/javascript" src="/static/js/jquery.js"></script>
    <script type="text/javascript" src="/static/js/jquery.unobtrusive-ajax.min.js"></script>
    <script type="text/javascript">
    function subForm() {
        $("#roleForm").submit()
    }
    function afterRoleEdit(data) {
        window.parent.AfterRoleEdit(data);
    }
    </script>
</head>
<body>
<div>
    正在为用户<span style="font-size:14px;color:red;font-weight: bolder">{{.user.UserName}}</span>分配角色
</div>

<form data-ajax="true" data-ajax-method="post" data-ajax-success="afterRoleEdit" data-ajax-url="/Admin/UserInfo/EditUserRole" id="roleForm">
    <input type="hidden" name="id" value="{{.user.Id}}" />
    <div>
        {{range $i,$v1:=.allRoles}}
        <div>
        {{if checkId $.userRole $v1.Id}}
                <input type="checkbox" name="cba_{{$v1.Id}}" checked="on" value="{{$v1.Id}}"/><label>{{$v1.RoleName}}</label>
            {{else}}
                <input type="checkbox" name="cba_{{$v1.Id}}" value="{{$v1.Id}}"/><label>{{$v1.RoleName}}</label>
            {{end}}
        </div>
        {{end}}
    </div>
</form>
</body>
</html>